package com.server.questionbank.snframe.mapper.Course.Type;

import com.server.questionbank.snframe.domain.Course.Type.CourseType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CourseTypeMapper {
    // 获取所有课程类型
    @Select("SELECT * FROM course_type;")
    public List<CourseType> getAllCourseType();

    // 根据课程id获取课程类型
    @Select("SELECT * FROM course_type, course_type_mapping " +
            "WHERE course_type.type_id = course_type_mapping.type_id " +
            "AND course_type_mapping.course_id = #{courseId};")
    public List<CourseType> getCourseTypeByClassId(@Param("courseId") Long courseId);

}
